package com.sh4.dao.impl;

import org.hibernate.Criteria;
import org.hibernate.criterion.Projections;
import org.springframework.stereotype.Repository;

import com.sh4.dao.PermissionDao;
import com.sh4.entity.Permission;

@Repository
public class PermissionDaoImpl extends BaseDaoImpl<Permission> implements PermissionDao{

	@Override
	public int permissionCount(String companyCode) {
		
		Criteria c = this.getSession().createCriteria(Permission.class);
		c.setProjection(Projections.rowCount());
		Number count = (Number) c.uniqueResult();
		return  count.intValue();
	}
	@Override
	public void deletePermission(String permissionId) {
		
		String sql = "delete from premission_resources where PERMISSION_ID_ = ?";
		
		this.executeUpdateBySql(sql, permissionId);
	}


}
